package com.feature.learn.proxy.method;

import java.lang.reflect.Method;

/**
 *
 * https://blog.csdn.net/wenyuan65/article/details/81145900
 *
 * @author 01390942
 * @Description
 * @create 2021/7/7
 * @since 1.0.0
 */
public class MethodInvoke {
    public static void main(String[] args) throws Exception {
        Method animalMethod = Animal.class.getDeclaredMethod("print");
        Method catMethod = Cat.class.getDeclaredMethod("print");

        Animal animal = new Animal();
        Cat cat = new Cat();
        animalMethod.invoke(cat);
        animalMethod.invoke(animal);

        catMethod.invoke(cat);
        catMethod.invoke(animal); //
    }
}